package java0419;


class A implements Cloneable{
    public B b;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}

class B implements Cloneable {
    public C c;

}

class C implements Cloneable{
    public String string;

    public C(String string) {
        this.string = string;
    }

//    @Override
//    protected Object clone() throws CloneNotSupportedException {
//        return super.clone();
//    }
}

// 使用 clone 方法必须要继承 Cloneable 接口,
// 虽然 Object 类中也有 clone() 方法, 但是不继承接口而直接使用会抛出异常
//
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
//        C c = new C("hello");
//        C c1 = (C)c.clone();
//        System.out.println(c.hashCode());
//        System.out.println(c1.hashCode());
    }
}
